package com.um.jdy.app.shop.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.um.jdy.app.shop.entity.dto.GoodsRecordPageDTO;
import com.um.jdy.app.shop.entity.vo.GoodsItemVO;
import com.um.jdy.app.shop.manager.GoodsRecordManager;
import com.um.springboot.starter.entity.Page;
import com.um.springboot.starter.orm.entity.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 商品
 * @author renjunwei
 * @date 2020/9/18 18:10
 */
@Api(tags = "商品")
@RestController
@RequestMapping("/api/v1/goods/record/")
@SaCheckLogin
@Validated
public class GoodsRecordContoller {

    @Autowired
    GoodsRecordManager goodsRecordManager;

    /**
     * 分页查询商品
     * @param dto
     * @return
     */
    @ApiOperation("分页查询商品")
    @GetMapping("page")
    public Response<Page<GoodsItemVO>> getPage(@Valid @ModelAttribute GoodsRecordPageDTO dto){
        return Response.success(goodsRecordManager.getPage(dto));
    }

}
